#include "bcitest.h"
#include <QBci>
#include <QCoreApplication>
#include <QLogger>
#include <QShell>

using namespace bci;

int main(int argc, char *argv[]) {
  QCoreApplication a(argc, argv);
  QLogger::init();
  QLogger::setModeLevel(QLogger::Level::debug);

  QShell shell;

  QBci bci(new BciTestSource("src"), new BciTestAnalysis("alz"),
           new BciTestUser("app"));

  shell.addSubCommand("start").addCallBack(
      [&bci](QCmdParser *) { bci.start(); });

  shell.addSubCommand("stop").addCallBack([&bci](QCmdParser *) { bci.stop(); });

  shell.addSubCommand("quit").addCallBack([&bci, &shell](QCmdParser *) {
    bci.stop();
    QCoreApplication::instance()->quit();
    shell.quit();
  });

  shell.parse(argc, argv);

  shell.execute();

  return a.exec();
}
